﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace Web.backStage.file
{
    public partial class userCharge : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void SearchUserButton_Click(object sender, EventArgs e)
        {
            Response.Redirect("searchUser.aspx");
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            TextBox1.Text = "";
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            int flag = BLL.charge.ChargeManager.Charge(TextBox1.Text, TextBox2.Text);
            if (flag == 0)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "MsgBox", "<script>alert('充值成功！');</script>");
                //Response.Redirect("userCharge.aspx");
            }
            else if (flag == 1)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "MsgBox", "<script>alert('充值卡不存在！');</script>");
            }
            else if (flag == 2)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "MsgBox", "<script>alert('充值卡已被使用！');</script>");
            }
            else if (flag == 3)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "MsgBox", "<script>alert('该充值卡没有被购买，不能够充值！');</script>");
            }
            else if (flag == 4)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "MsgBox", "<script>alert('充值失败！');</script>");
            }
        }

        protected void ChargeButton_Click(object sender, EventArgs e)
        {
            Response.Redirect("userCharge.aspx");
        }
    }
}